package cn.com.bsoft.cloud.model


import cn.com.bsoft.cloud.entity.cloud.DoctorInformation
import cn.net.xyan.blossom.kotlin.AllOpen
import cn.net.xyan.blossom.kotlin.NoArg
import com.fasterxml.jackson.annotation.JsonFormat
import java.util.*


enum class QueryLogic(val index: Int) {
    And(1), Or(2)
}


@NoArg
data class RegisterReq(val validCode: String, val loginName: String, val identifyNo: String, val realName: String) {
    var password: String? = null
    var telePhoneNo: String? = null
    var address: String? = null
    var email: String? = null
    var encrypt:Boolean ? = null
}

@NoArg
data class UpdatePersonReq(val validCode: String, val loginName: String) {
    var identifyNo: String? = null
    var realName: String? = null
    var password: String? = null
    var telePhoneNo: String? = null
    var address: String? = null
    var email: String? = null
    var defaultCard: String? = null
}


@NoArg
class QueryPersonReq {
    var loginName: String? = null
    var identifyNo: String? = null
    var telePhoneNo: String? = null
    var email: String? = null
    var logic: QueryLogic = QueryLogic.Or
    var cardNo: String? = null
    var betaAvailable: Boolean? = null
    var loginInfoVendor: String? = null
}


@NoArg
class CheckLoginReq(val loginName: String, val password: String) {
    var needToken: Boolean? = null
}

@NoArg
class TempLoginReq(val idNo: String, val password: String)

@NoArg
class MergeTempReq(val idNo: String, val loginName: String, val phone: String, val vaildCode: String)

@NoArg
@AllOpen
class PersonRsp(val loginName: String, val identifyNo: String, val realName: String) {
    var telePhoneNo: String? = null
    var address: String? = null
    var email: String? = null
    var defaultCard: String? = null

    var betaAvailable: Boolean? = null

    var loginInfos: MutableList<LoginInfoRsp> = LinkedList()
}

class LoginRsp{
    var person:PersonRsp?=null
    var token:Any?=null
    var doctor:List<DoctorInformation>?=null
    var key:Any?=null
}

class IMGetParameter{
    var appID:String?=null
    var principal:String?=null
}

class IMRegisterParameter{
    var appID:String?=null
    var principal:String?=null
    var nickName:String?=null
    var avatar:String?=null
}

class DoctorParameter{
    var logName:String?=null
}

class DoctorResult{
    var code:String?=null
    var msg:String?=null
    var result:List<DoctorInformation>?=null

}

class LoginResult{
    var code:String?=null
    var msg:String?=null
    var result:LoginRsp?=null

}
class ScheduleRecordTokenParameter{
    var loginName:String? =null
}

class ScheduleRecordToken{
    var uid:String? =null
    var token:String?= null
    var nickName:String?=null
    var avatar:String?=null
}

class CheckLoginRsp(loginName: String, identifyNo: String, realName: String) : PersonRsp(loginName, identifyNo, realName) {
    var token: String? = null
    var sessionID: String? = null
    var refreashToken: String? = null
}


@NoArg
data class ListCardReq(val identifyNo: String)

@NoArg
class DirectAddCardReq{
    var cardNo:String? = null
    var cardType:Int? = null
    var identifyNo:String? = null
}

@NoArg
data class BindCardReq(val cardNo: String, val cardType: Int, val issuer: String?, val identifyNo: String, val otherIdentifyNo: String = identifyNo) {
    var patientName: String? = null
}

class AsyncBindCardRsp {
    companion object {
        val Waiting = 0
        val Success = 1
        val Fail = 11
    }

    var status: Int? = null
    var msg: String? = null
    var uuid: String? = null
}

class QueryAsyncBindCardReq {
    var uuids: MutableList<String> = LinkedList()
    var userIdentifyNo: String? = null
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    var begin: Date? = null

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    var end: Date? = null
    var status: Int? = null
}


@NoArg
data class RemoveCardReq(val cardNo: String, val cardType: Int, val issuer: String?, val identifyNo: String)

class QuerySessionReq {
    var loginName: String? = null
    var sessionID: String? = null
}

class SessionRsp {
    var sessionID: String? = null

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    var createDate: Date? = null

    var status: Int? = null

    var person: PersonRsp? = null
}